<template>
  <div class="global-common-page-template-container">
    <common-header :title="title" v-if="title || $slots.header">
      <slot name="tabs" slot="tabs"></slot>
      <slot name="header-content" slot="header-content"></slot>
      <slot name="header" slot="default"></slot>
    </common-header>
    <div
      :class="[
        'common-page-content',
        isPadding ? 'page-inside-padding' : '',
        $slots.header && $slots.pagination
          ? 'page-have-header-pagination'
          : $slots.header
          ? 'page-have-header'
          : 'page-no-header',
      ]"
    >
      <slot name="content"></slot>
    </div>

    <div class="common-page-pagination" v-if="$slots.pagination">
      <slot name="pagination"></slot>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: "CommonPage",
  props: {
    title: {
      type: String,
      default: "",
    },
    isPadding: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {};
  },
  methods: {},
  mounted() {},
};
</script>

<style scoped lang="scss">
.global-common-page-template-container {
  position: absolute;
  // background-color: #fff;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  z-index: 1099;

  .common-page-content {
    /*overflow: scroll;*/
    overflow: hidden;
    flex: 1;
  }

  .page-have-header {
    height: calc(100% - 46px);
  }

  .page-have-header-pagination {
    height: calc(100% - 110px);
  }

  .page-inside-padding {
    padding: 12px;
    box-sizing: border-box;
  }

  .page-no-header {
    height: 100%;
  }

  .common-page-pagination {
    padding: 0 18px;
  }
}
</style>
